cmake_minimum_required(VERSION 3.12)

# 设置依赖库目录
if(WIN32)
    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
        set(DEP_PLATFORM_DIR "${CMAKE_CURRENT_SOURCE_DIR}/win/x64")
    else()
        set(DEP_PLATFORM_DIR "${CMAKE_CURRENT_SOURCE_DIR}/win/x86")
    endif()
elseif(UNIX AND NOT APPLE)
    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
        set(DEP_PLATFORM_DIR "${CMAKE_CURRENT_SOURCE_DIR}/linux/x64")
    else()
        set(DEP_PLATFORM_DIR "${CMAKE_CURRENT_SOURCE_DIR}/linux/x86")
    endif()
elseif(APPLE)
    set(DEP_PLATFORM_DIR "${CMAKE_CURRENT_SOURCE_DIR}/macos")
else()
    message(FATAL_ERROR "不支持的平台")
endif()

# 通用依赖库目录
set(DEP_COMMON_DIR "${CMAKE_CURRENT_SOURCE_DIR}/common")

# 导出依赖库路径
set(DEP_DIR ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
set(DEP_PLATFORM_DIR ${DEP_PLATFORM_DIR} PARENT_SCOPE)
set(DEP_COMMON_DIR ${DEP_COMMON_DIR} PARENT_SCOPE)

# 添加包含目录
include_directories(
    ${DEP_PLATFORM_DIR}/include
    ${DEP_COMMON_DIR}/include
)

# 添加库目录
link_directories(
    ${DEP_PLATFORM_DIR}/lib
    ${DEP_COMMON_DIR}/lib
)

# 可选：加载特定依赖库的子CMake文件
# 这样可以将每个库的配置分开管理
file(GLOB DEP_CMAKE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake/*.cmake")
foreach(DEP_CMAKE_FILE ${DEP_CMAKE_FILES})
    include(${DEP_CMAKE_FILE})
endforeach() 